package com.googlecode.jtoy.patterns.command;

import java.util.LinkedList;

public class ActiveObjectEngine {

	LinkedList<Command> commands = new LinkedList<Command>();

	public void addCommand(Command command) {

		commands.add(command);
	}

	public void run() throws Exception {

		while (!commands.isEmpty()) {
			Command c = commands.getFirst();
			commands.removeFirst();
			c.execute();
		}
	}
}
